<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <button @click="handleClick()">获取影片信息</button>
        <ul v-for="film in filmsList">
            <li>
                <h3>{{ film.name }}</h3>
                <img :src="film.poster">
            </li>
        </ul>
    </div>

    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                filmsList: []
            },
            methods: {
                handleClick()
                {
                    fetch("./json/test.json")
                    .then(res => res.json())
                    .then(res => this.filmsList = res.data.films)
                }
            },
        })
    </script>
</body>
</html>